using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;
namespace CSF.Communications.Sdp.ServiceLogic.Exceptions
{
     
        [Serializable]
        public class SDPException : Exception
        {
            #region Private Members

            private string message;
            private int eventId;

            #endregion Members

            #region Public Properties

            /// <summary>
            /// Get property for message
            /// </summary>
            public override string Message
            {
                get
                {
                    return this.message;
                }
            }

            /// <summary>
            /// Get property for eventId
            /// </summary>
            public int EventId
            {
                get
                {
                    return this.eventId;
                }

                set
                {
                    eventId = value;
                }
            }

            #endregion Properties

            #region Constructors

            #region SDPException

            /// <summary>
            ///   Default Constructor
            /// </summary>
            public SDPException()
            {

            }

            #endregion SDPException

            #region SDPException(string)

            /// <summary>
            /// Contructor which takes the description
            /// </summary>
            /// <param name="description">The description</param>
            public SDPException(string description)
            {
                message = description;
            }

            #endregion SDPException(string)

            #region SDPException(Exception)

            /// <summary>
            /// Contructor which takes the base exception as parameter
            /// </summary>
            /// <param name="baseException">The base exception to be passed</param>
            public SDPException(Exception baseException)
            {
                message = baseException.Message;
            }

            #endregion SDPException(Exception)

            #region SDPException(string,Exception)

            /// <summary>
            /// Contructor which takes the description and the base exception
            /// </summary>
            /// <param name="description">The description</param>
            /// <param name="baseException">The base exception to be passed</param>
            public SDPException(string description, Exception baseException)
            {
                message = description + Environment.NewLine + baseException.Message;
            }

            #endregion SDPException(string,Exception)

            #region SDPException(SerializationInfo , StreamingContext)

            /// <summary>
            /// Contructor which takes the description and the base exception
            /// </summary>
            /// <param name="SerializationInfo">The SerializationInfo</param>
            /// <param name="StreamingContext">StreamingContext</param>
            public SDPException(SerializationInfo info, StreamingContext context)
            {
                eventId = info.GetInt32("EventId");
                message = info.GetString("Message");

            }
            #endregion SDPException(SerializationInfo, StreamingContext)


            #endregion

            #region GetObjectData
            /// <summary>
            /// It's called by the serializer to get the object data
            /// </summary>
            /// <param name="info"></param>
            /// <param name="context"></param>
            public override void GetObjectData(SerializationInfo info, StreamingContext context)
            {
                info.AddValue("EventId", eventId);
                info.AddValue("Message", message);
            }
            #endregion
        }
    }


